package com.fred.learning.springbootdubbosampleconsumer;

import com.fred.learning.spring.boot.dubbo.sample.api.ISayHelloService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fred
 * @date 2021/7/5 上午10:17
 * @description 服务降级 test
 */

@RestController
public class SayController {


    @DubboReference(protocol = "dubbo",
            loadbalance = "consistenthash",
            mock = "com.fred.learning.springbootdubbosampleconsumer.MockSayHelloService",
            timeout = 500,
            cluster = "failfast", //测试使用
            check = true //启动检查
            )
    ISayHelloService sayHelloService;

    @GetMapping("testmock")
    public String say() {

        return sayHelloService.say("fred");
    }

}
